/*
 * @Author: aum
 * @Date: 2021-03-03 11:21:45
 * @LastEditTime: 2021-08-27 18:40:16
 * @LastEditors: aum
 * @Description:
 * @FilePath: \vue3-hand-vant\src\api\user.ts
 */
import Http from '@/utils/http'
import { AccountLoginParams, AccountLoginModel } from './model/user'
import { CustomOpts } from 'axios'

/**
 * 用户登录
 */
export const accountLoginApi = (params: AccountLoginParams, options?: CustomOpts) => {
  const headers = {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'application-id': '4acfe3587bf347879a81c7b33f93d789',
      'application-token': 'd6e6cb19e3b9c02f89d6cd54cfa7c613',
      Authorization: 'Basic Y2xpZW50OnNlY3JldA=='
    }
  }
  return Http.post<AccountLoginModel>(
    `http://gateway-smmsprd.crland.com.cn/oauth-psp/oauth/token?grant_type=password&username=${params.username}&password=${params.password}`,
    params,
    options,
    headers
  )
}
